﻿cmake_minimum_required(VERSION 3.5)

project(RXEntitySystem VERSION 0.1 LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(ProgramName RXEntitySystem)

include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/../ReflectX
    )
	
set(RXShadowWorldSource 
  RXShadowWorld/RXAspect.cpp
  RXShadowWorld/RXAspect.h
  RXShadowWorld/RXAspectEngine.cpp
  RXShadowWorld/RXAspectEngine.h
  RXShadowWorld/RXShadowNode.cpp
  RXShadowWorld/RXShadowNode.h
  RXShadowWorld/RXShadowWorld.cpp
  RXShadowWorld/RXShadowWorld.h
)

set(RXBasicAspectSource 
  RXBasicAspect/RXBasicAspect.cpp
  RXBasicAspect/RXBasicAspect.h
  RXBasicAspect/RXBasicAspectService.cpp
  RXBasicAspect/RXBasicAspectService.h
  RXBasicAspect/RXBasicAspectShadowNode.cpp
  RXBasicAspect/RXBasicAspectShadowNode.h
  RXBasicAspect/RXBasicAspectDef.h
  RXBasicAspect/RXBasicAspect
)
	
set(RXNetworkAspectSource
  RXNetworkAspect/RXNetworkAspect.cpp
  RXNetworkAspect/RXNetworkAspect.h
  RXNetworkAspect/RXNetwork
  RXNetworkAspect/RXNetworkDef.h
  RXNetworkAspect/RXSyncComponent.cpp
  RXNetworkAspect/RXSyncComponent.h
  RXNetworkAspect/RXSyncControllerComponent.cpp
  RXNetworkAspect/RXSyncControllerComponent.h
  RXNetworkAspect/RXSyncControllerShadowNode.cpp
  RXNetworkAspect/RXSyncControllerShadowNode.h
  RXNetworkAspect/RXSyncShadowNode.cpp
  RXNetworkAspect/RXSyncShadowNode.h
  RXNetworkAspect/RXRemoteEvent.cpp
  RXNetworkAspect/RXRemoteEvent.h
  RXNetworkAspect/RXSyncNodeListener.cpp
  RXNetworkAspect/RXSyncNodeListener.h
  RXNetworkAspect/RXNetworkEvent_P.cpp
  RXNetworkAspect/RXNetworkEvent_P.h
  RXNetworkAspect/RXNodeMapper.cpp
  RXNetworkAspect/RXNodeMapper.h
  RXNetworkAspect/RXNetworkMessage_P.cpp
  RXNetworkAspect/RXNetworkMessage_P.h
)

set(FrameAspectSource
  FrameAspect/FrameAspect.cpp
  FrameAspect/FrameAspect.h
  FrameAspect/FrameComponent.cpp
  FrameAspect/FrameComponent.h
  FrameAspect/FrameShadowNode.cpp
  FrameAspect/FrameShadowNode.h
  FrameAspect/FrameAspect
  FrameAspect/FrameAspectDef.h
  FrameAspect/FrameAspectTypes.cpp
  FrameAspect/FrameAspectTypes.h
  FrameAspect/TimelineComponent.cpp
  FrameAspect/TimelineComponent.h
  FrameAspect/TimelineShadowNode.cpp
  FrameAspect/TimelineShadowNode.h
)

SOURCE_GROUP("RXShadowWorld" FILES ${RXShadowWorldSource})
SOURCE_GROUP("RXBasicAspect" FILES ${RXBasicAspectSource})
SOURCE_GROUP("RXNetworkAspect" FILES ${RXNetworkAspectSource})
SOURCE_GROUP("FrameAspect" FILES ${FrameAspectSource})


add_library(${ProgramName} SHARED
  RXEntitySystem_global.h
  RXWorld.h
  RXWorld.cpp
  RXEntity.h
  RXEntity.cpp
  RXNode.cpp
  RXNode.h
  RXTree.cpp
  RXTree.h
  RXComponent.cpp
  RXComponent.h
  RXECSDef.h
  RXAsset.cpp
  RXAsset.h
  RXNodeCreationInfo.cpp
  RXNodeCreationInfo.h
  ${RXShadowWorldSource}
  ${RXBasicAspectSource}
  ${RXNetworkAspectSource}
  ${FrameAspectSource}
)

if(UNIX)
	set(LIB_PTHREAD -pthread)
endif()

target_link_libraries(${ProgramName} ${LIB_PTHREAD} ReflectX)
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
target_compile_definitions(RXEntitySystem PRIVATE RXEntitySystem_LIBRARY)
